package com.jzo2o.market.controller.consumer;

import com.jzo2o.common.model.CurrentUserInfo;
import com.jzo2o.market.model.dto.request.CouponLimitReqDTO;
import com.jzo2o.market.model.dto.response.CouponInfoResDTO;
import com.jzo2o.market.service.ICouponService;
import com.jzo2o.mvc.utils.UserContext;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ Tool：IntelliJ IDEA
 * @ Author：徐茂茂
 * @ Date：2025-10-16-2:11
 * @ Version：1.0
 * @ Description：
 */
@RestController("consumerCouponController")
@RequestMapping("/consumer/coupon")
public class CouponController {
    @Resource
    private ICouponService couponService;

    @GetMapping("/my")
    public List<CouponInfoResDTO> myCoupons(CouponLimitReqDTO couponLimitReqDTO){
        CurrentUserInfo currentUserInfo = UserContext.currentUser();
        couponLimitReqDTO.setUserId(currentUserInfo.getId());
        return couponService.myCoupons(couponLimitReqDTO);
    }

}
